package com.bs.web.rest;

import com.bs.domain.Cluster;
import com.bs.domain.FilebeatConfig;
import com.bs.service.ClusterService;
import com.bs.service.FilebeatConfigService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Author: wujian
 * Time: 2019/01/17
 * Desc:
 */
@RestController
@RequestMapping("/api/filebeatconfig")
public class FilebeatConfigResource {

    @Autowired
    private FilebeatConfigService filebeatConfigService;

    @GetMapping("/query")
    public List<FilebeatConfig> findAll(){
        return filebeatConfigService.findAll();
    }

    @PostMapping("/save")
    public FilebeatConfig save(@RequestBody FilebeatConfig filebeatConfig){
        return filebeatConfigService.save(filebeatConfig);
    }

    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable Long id){
        filebeatConfigService.delete(id);
    }

    @PostMapping("/upload")
    public void upload(@RequestBody FilebeatConfig filebeatConfig){
        filebeatConfigService.upload(filebeatConfig);
    }
}
